package org.jin.samples.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name="exam_role")
public class ExamRole implements Serializable{
	
	private static final long serialVersionUID = -4467470559153981517L;

	@Id
	@Column(name = "role_id")
	private Integer roleId;
	
	@Column(name= "name")
	private String name;
	
	@ManyToMany(cascade = {CascadeType.DETACH, CascadeType.PERSIST, CascadeType.MERGE})
	@JoinTable(name="exam_user_role",
			joinColumns={
					@JoinColumn(name ="role_id", referencedColumnName="role_id")
	},
	 inverseJoinColumns={
				@JoinColumn(name="user_id", referencedColumnName="user_id")
	}
		)
	private Set<ExamUser> user;

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<ExamUser> getUser() {
		return user;
	}

	public void setUser(Set<ExamUser> user) {
		this.user = user;
	}

	public ExamRole() {
		super();
	}
	
	
	
	
}
